ccR.Hunter = {
	Masters_Call = 
	function() 
		if ccR.Spell.Is.Ready(MASTERS_CALL)
		and ccR.Pet.Exists() 
		and ccR.Pet.Distance("player") <= 38 
		then 
			local eventIndex = C_LossOfControl.GetNumEvents() 
			while (eventIndex > 0) do 
				local _, _, text = C_LossOfControl.GetEventInfo(eventIndex)	
				if text == LOSS_OF_CONTROL_DISPLAY_ROOT 
				or text == LOSS_OF_CONTROL_DISPLAY_SNARE 
				or text == LOSS_OF_CONTROL_DISPLAY_STUN_MECHANIC 
				or text == LOSS_OF_CONTROL_DISPLAY_STUN 
				then 
					if ccR.Player.Is.Casting() and not ccR.Player.Is.ChannelingSpell(BARRAGE) then SpellStopCasting() end 
					if ccR.Player.Is.Casting() and not ccR.Player.Is.ChannelingSpell(BARRAGE) then SpellStopCasting() end 
					ccR.Cast.Spell(MASTERS_CALL) 
				end
				eventIndex = eventIndex - 1 
			end 
		end 
	end,
	Counter_Shot = 
	function() 
		if ccR.Spell.Is.Ready(COUNTER_SHOT) then 
			for x = 1, # ccR_Enemies_In_Combat do 
				local vObject = ccR_Enemies_In_Combat[x] 
				if ccR.Unit.Is.Attackable(vObject) 
				and ccR.Player.IsFacing(vObject)
				and ccR.Spell.CanAttack(COUNTER_SHOT, vObject) 
				and ccR.Spell.CooldownTime(COUNTER_SHOT) < 1
				and ccR.Unit.IsCastingOrChanneling(vObject)
				then
					if ccR.Player.Is.Casting() and not ccR.Player.Is.ChannelingSpell(BARRAGE) then SpellStopCasting() end 
					if ccR.Player.Is.Casting() and not ccR.Player.Is.ChannelingSpell(BARRAGE) then SpellStopCasting() end 
					ccR.Cast.Attack(COUNTER_SHOT, vObject)
				end
			end
		end
	end,
	Kill_Shot =	
	function() 
		for x = 1, # ccR_Enemies_In_Combat do
			local vObject = ccR_Enemies_In_Combat[x]
			if ccR.Unit.Is.Attackable(vObject)
			and ccR.Player.Is.Facing(vObject)
			and (
					(not ccR.Player.Has.Spell(ENHANCED_KILL_SHOT) and ccR.Unit.Health(vObject) <= 20)
					or
					(ccR.Player.Has.Spell(ENHANCED_KILL_SHOT) and ccR.Unit.Health(vObject) <= 35)
				)
			and ccR.Spell.CooldownTime(KILL_SHOT) < 1
			and ccR.Unit.Distance(vObject, "player") <= 45
			then
				if ccR.Player.Is.Casting() and not ccR.Player.Is.ChannelingSpell(BARRAGE) then SpellStopCasting() end 
				if ccR.Player.Is.Casting() and not ccR.Player.Is.ChannelingSpell(BARRAGE) then SpellStopCasting() end 
				ccR.Cast.Spell(KILL_SHOT, vObject)
			end
		end
	end,
	Mend_Pet = 
	function() 
		if ccR.Pet.Exists() 
		and ccR.Pet.IsAlive() 
		and ccR.Pet.Distance("player") <= 45 
		and ccR.Pet.IsInLineOfSight("player") 
		and ccR.Pet.Health() <= 80 
		and ccR.Spell.Is.Ready(MEND_PET) 
		and not ccR.Pet.HasBuff(MEND_PET) 
		then
			if ccR.Player.Is.Casting() and not ccR.Player.Is.ChannelingSpell(BARRAGE) then SpellStopCasting() end 
			if ccR.Player.Is.Casting() and not ccR.Player.Is.ChannelingSpell(BARRAGE) then SpellStopCasting() end 
			ccR.Cast.Spell(MEND_PET) 
		end
	end,
	Misdirection =
	function()
		if ccR.Spell.Is.Ready(MISDIRECTION)
		and ccR.Pet.Exists()
		and not ccR.Player.Has.Buff(MISDIRECTION)
		then
			for x = 1, # ccR_Enemies_Within_44 do
				local vUnit = ccR_Enemies_Within_44[x]
				if ccR.Unit.Is.Attackable(vUnit)
				and ccR.Player.Is.Facing(vUnit)
				and ccR.Unit.TargetName(vUnit) == ccR.Player.Name()
				and ccR.Unit.Is.InLineOfSight("pet", "player")
				and not ccR.Unit.Is.EnemyPlayer(vUnit)				
				then
					if ccR.Player.Is.Casting() and not ccR.Player.Is.ChannelingSpell(BARRAGE) then SpellStopCasting() end 
					if ccR.Player.Is.Casting() and not ccR.Player.Is.ChannelingSpell(BARRAGE) then SpellStopCasting() end 
					TargetUnit(vUnit)
					ccR.Cast.Spell(MISDIRECTION, "pet")
					PetAttack(vUnit)
				end
			end
		end
	end,
	Aspect_of_the_Cheetah =
	function()
		if ccR.Player.Has.Spell(ASPECT_OF_THE_CHEETAH)
		and ccR.Spell.Is.Ready(ASPECT_OF_THE_CHEETAH)
		and ccR.Player.Is.Moving()
		and not ccR.Player.Has.Buff(ASPECT_OF_THE_CHEETAH)
		and not ccR.Player.Has.Buff(ASPECT_OF_THE_PACK)
		and not ccR.Player.Is.CastingOrChanneling()
		and not ccR.Player.Is.ChannelingSpell(BARRAGE)
		then
			if ccR.Player.Has.Glyph(GLYPH_OF_ASPECT_OF_THE_CHEETAH) then
				ccR.Cast.Spell(ASPECT_OF_THE_CHEETAH)
			else
				if not ccR.Player.Is.In.Combat() then
					ccR.Cast.Spell(ASPECT_OF_THE_CHEETAH)
				end
			end
		end
	end,
}
setmetatable(ccR.Hunter, ccR)